package st.magnuzon.book.client.custom.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.UrlBuilder;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class ConsoleLinkWidget extends Composite {

	private static ConsoleLinkWidgetUiBinder uiBinder = GWT.create(ConsoleLinkWidgetUiBinder.class);

	@UiField
	Anchor consoleLink;

	interface ConsoleLinkWidgetUiBinder extends UiBinder<Widget, ConsoleLinkWidget> {
	}

	public ConsoleLinkWidget() {
		initWidget(uiBinder.createAndBindUi(this));
		UrlBuilder urlBuilder = Window.Location.createUrlBuilder();
        urlBuilder.setPath("/admin/console.html");
        setConsoleUrl(urlBuilder.buildString());
	}
	
	public void setConsoleUrl(String url) {
        consoleLink.setHref(url);
    }
}
